﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClassLibrary;
using GatewayFysioWeb;


namespace GatewayFysioWeb 
{
    public partial class WebForm1 : System.Web.UI.Page 
    {
        private GatewayPatient patientgateway;
        protected void Page_Load(object sender, EventArgs e)
        {
           
            patientgateway = new GatewayPatient();
    
        }

        protected void btnOpret_Click(object sender, EventArgs e)
        {
           string cpr = TxtCpr.Text;
           string name = txtName.Text;
           string adresse = txtAdresse.Text;
           int zip = int.Parse(txtZip.Text);  
           string city = txtCity.Text;
           int phonenumber = int.Parse(txtPhone.Text);
           string email = txtEmail.Text;
           Patient patient = new Patient(cpr,name, adresse, zip, city, phonenumber, email);

           patientgateway.Create(patient);
           GlobaleWebData.UdvalgtPatient = patient;
           
         
        }

        protected void btnFindAlle_Click(object sender, EventArgs e)
        {
            List<Patient> listPatienter = patientgateway.LoadAll();
            GlobaleWebData.UdvalgtPatientListe = listPatienter;


            //for (int i = 0; i < listPatienter.Count; i++)
            //{   
            //    patientgateway.Delete(listPatienter[i]);
                 
            //}
        }
    }
}